﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ClassLibrary.DAO;

namespace mprsc
{
    public partial class FindJob : Form
    {
        TblJobsDAO jobDAO = new TblJobsDAO(Global.CONNECTION_STRING);
        public FindJob()
        {
            InitializeComponent();
            DataTable dt = jobDAO.GetJob(Global.ConvertToInt(txtJobID.Text), "");
            gridJob.DataSource = dt;
        }
      
        private void button1_Click(object sender, EventArgs e)
        {
            DataTable dt = jobDAO.GetJob(Global.ConvertToInt(txtJobID.Text), "");
            gridJob.DataSource = dt; 
        }
        // truyền JobID sang Booking
        private void button2_Click(object sender, EventArgs e)
        {
            string id = gridJob.CurrentRow.Cells["JobID"].Value.ToString();
           // string idC = gridJob.CurrentRow.Cells["CustomerIndex"].Value.ToString();
            NewBooking newBooking = new NewBooking();
            newBooking.Sender(id);
           // newBooking.Sender(idC);
            this.Hide();
            newBooking.Show();
        }
        // truyền CustomerIndex cho AddNewCustomer - Xem chi tiết

        private void button3_Click(object sender, EventArgs e)
        {
            string idC = gridJob.CurrentRow.Cells["CustomerIndex"].Value.ToString();
            //Tạo AddNewCustomer
            NewCustomer addnewCus = new NewCustomer();
            addnewCus.Sender(idC); //Gọi delegate
            this.Hide();
            addnewCus.Show();            
        }

        private void FindJob_Load(object sender, EventArgs e)
        {
            this.CenterToParent();
        }
    }
}
